package com.inossem.utils.encryption;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

/**
 * Created by leij on 2017/6/30.
 */

public class URLUtils {

    private static final String CHARSET = "UTF-8";

    public static String encode(String message) {
        String result = "";
        try {
            result = URLEncoder.encode(message, CHARSET);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return result;
    }

    public static String decode(String code) {
        String result = "";
        try {
            result = URLDecoder.decode(code, CHARSET);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return result;
    }

}
